function sha1(a) {
    function b(a, b) {
        var c = (a & 65535) + (b & 65535);
        return (a >> 16) + (b >> 16) + (c >> 16) << 16 | c & 65535
    }
    for (var c = [], d = 0; d < 8 * a.length; d += 8)
        c[d >> 5] |= (a.charCodeAt(d / 8) & 255) << 24 - d % 32;
    a = 8 * a.length;
    c[a >> 5] |= 128 << 24 - a % 32;
    c[(a + 64 >> 9 << 4) + 15] = a;
    a = Array(80);
    for (var d = 1732584193, e = -271733879, f = -1732584194, g = 271733878, k = -1009589776, j = 0; j < c.length; j += 16) {
        for (var m = d, l = e, n = f, p = g, q = k, h = 0; 80 > h; h++) {
            a[h] = 16 > h ? c[j + h] : (a[h - 3] ^ a[h - 8] ^ a[h - 14] ^ a[h - 16]) << 1 | (a[h - 3] ^ a[h - 8] ^ a[h - 14] ^ a[h - 16]) >>> 31;
            var r = b(b(d << 5 | d >>> 27, 20 > h ? e & f | ~e & g : 40 > h ? e ^ f ^ g : 60 > h ? e & f | e & g | f & g : e ^ f ^ g), b(b(k, a[h]), 20 > h ? 1518500249 : 40 > h ? 1859775393 : 60 > h ? -1894007588 : -899497514))
              , k = g
              , g = f
              , f = e << 30 | e >>> 2
              , e = d
              , d = r
        }
        d = b(d, m);
        e = b(e, l);
        f = b(f, n);
        g = b(g, p);
        k = b(k, q)
    }
    c = [d, e, f, g, k];
    a = "";
    for (d = 0; d < 4 * c.length; d++)
        a += "0123456789abcdef".charAt(c[d >> 2] >> 8 * (3 - d % 4) + 4 & 15) + "0123456789abcdef".charAt(c[d >> 2] >> 8 * (3 - d % 4) & 15);
    return a
}

(function() {
    function a(a, c) {
        var d = (a & 65535) + (c & 65535);
        return (a >> 16) + (c >> 16) + (d >> 16) << 16 | d & 65535
    }
    globalThis.calcDigest = function(b) {
        for (var c = (b.length + 8 >> 6) + 1, d = Array(16 * c), e = 0; e < 16 * c; e++)
            d[e] = 0;
        for (e = 0; e < b.length; e++)
            d[e >> 2] |= b.charCodeAt(e) << 24 - 8 * (e & 3);
        d[e >> 2] |= 128 << 24 - 8 * (e & 3);
        d[16 * c - 1] = 8 * b.length;
        b = Array(80);
        for (var c = 1732584193, e = -271733879, f = -1732584194, g = 271733878, k = -1009589776, j = 0; j < d.length; j += 16) {
            for (var m = c, l = e, n = f, p = g, q = k, h = 0; 80 > h; h++) {
                b[h] = 16 > h ? d[j + h] : (b[h - 3] ^ b[h - 8] ^ b[h - 14] ^ b[h - 16]) << 1 | (b[h - 3] ^ b[h - 8] ^ b[h - 14] ^ b[h - 16]) >>> 31;
                var r = a(a(c << 5 | c >>> 27, 20 > h ? e & f | ~e & g : 40 > h ? e ^ f ^ g : 60 > h ? e & f | e & g | f & g : e ^ f ^ g), a(a(k, b[h]), 20 > h ? 1518500249 : 40 > h ? 1859775393 : 60 > h ? -1894007588 : -899497514))
                  , k = g
                  , g = f
                  , f = e << 30 | e >>> 2
                  , e = c
                  , c = r
            }
            c = a(c, m);
            e = a(e, l);
            f = a(f, n);
            g = a(g, p);
            k = a(k, q)
        }
        d = [c, e, f, g, k];
        b = "";
        for (c = 0; c < 4 * d.length; c++)
            b += "0123456789abcdef".charAt(d[c >> 2] >> 8 * (3 - c % 4) + 4 & 15) + "0123456789abcdef".charAt(d[c >> 2] >> 8 * (3 - c % 4) & 15);
        return b
    }
}
)();



console.log(sha1('18922422963'))
pwd = 'a12345678'
console.log(globalThis.calcDigest("fetion.com.cn:"+pwd))
